<!DOCTYPE html>
<!--[if lte IE 9]><html class="lt-ie10 lt-ie9" xmlns="http://www.w3.org/1999/xhtml"> <![endif]-->
<!--[if gt IE 9]><!-->
<html>
<!--<![endif]-->

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>赛尔（赛er）——竞赛列表</title>
  <meta name="keywords" content="赛尔（赛er）是一个面向全国各大高校大学生的一站式社区平台，集竞赛活动发布和讨论为一体，提供发布、查询、组队、经验分享等多元化服务。" />
  <meta name="description"
    content="平台聚合了国内各大高校的校内比赛以及国内外各领域最优质的赛事活动信息。赛事内容囊括创新创业、演讲辩论、财会金融、艺术设计、学科竞赛、公益志愿等众多领域。赛尔（赛er）致力于打造一个融合大学生学习、赛事、活动、保研、考研等为一体的成长交流空间。" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta http-equiv="Access-Control-Allow-Origin" content="*" />
  <meta name="renderer" content="webkit">

  <link rel="stylesheet" type="text/css" href="/static/css/top-4.9.6.2.min.css">
  <link rel="stylesheet" type="text/css" href="/static/css/contest.info-4.9.6.min.css">
  <link rel="stylesheet" type="text/css" href="/static/css/search.school.pop.min.css">
  <link rel="stylesheet" type="text/css" href="/static/css/recommend.min.css">
  <link rel="stylesheet" type="text/css" href="/static/css/activity-4.3.1.1.min.css">

  <script src="/common/common.js"></script>
  <!-- 引入样式 -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <!-- 引入组件库 -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <style>
    .layui-form-switch{
      margin-top:0!important;
    }
  </style>
</head>

<body>
  <div style="display:none;position:absolute;left:0;top:0;">
    <img src="/static/picture/wechat_share_icon.png" id="weChatShareIcon">
  </div>
  <!--body-wrap-->
  <div class="body-wrap">
    <div id="app" class="body-main main-wrap v-4-2">
      <ul class="layui-nav layui-bg-cyan" style="margin: 0 auto;padding:0 12%" lay-filter="">
        <li style="display: inline-block;line-height: 60px;vertical-align: middle;position: relative;"><a
            href="/index.html"><img style="height: 60px;margin-right:15px;"
              src="/static/images/logo.png"></a></li>
        <!-- 选中 加上 layui-this -->
        <li class="layui-nav-item"><a href="/index.html">首页</a></li>
        <li class="layui-nav-item layui-this"><a href="/competition/competition.html">竞赛</a></li>
        <li class="layui-nav-item"><a href="/activity/activity.html">活动</a></li>
        <li class="layui-nav-item"><a href="/ask/ask.html">论坛</a></li>
        <li class="layui-nav-item"><a href="/article/article.html">文章</a></li>
        <li class="layui-nav-item" v-if="user!=''&&user!=null&&user!=undefined">
          <a href="javascript:;">发布</a>
          <dl class="layui-nav-child">
            <!-- 二级菜单 -->
            <dd><a href="/competition/publish_competition.html">创建竞赛</a></dd>
            <dd><a href="/activity/publish_activity.html">发布活动</a></dd>
            <dd><a href="/ask/publish_ask.html">发起提问</a></dd>
            <dd><a href="/article/publish_article.html">发表文章</a></dd>
          </dl>
        </li>
        <template v-if="user!=''&&user!=null&&user!=undefined">
          <li class="layui-nav-item" style="float: right">
            <a href="javascript:;" style="padding: 0 20px 0 0px">
              <img :src="NGINX_SERVER+user.AVATAR" class="layui-nav-img">
              {{user.NAME}}
            </a>
            <dl class="layui-nav-child">
              <dd><a href="/user/my_home.html">我的主页</a></dd>
              <dd><a href="javascript:void(0);" style="color:red" onclick="logout()">退出登录</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item" style="float: right;margin-right: 25px;">
            <a href="/user/my_msg.html" style="cursor: pointer;"><i class="layui-icon layui-icon-notice"
                style="font-size: 18px;"></i><span class="layui-badge" v-if="unreadCount>0">{{unreadCount}}</span></a>
          </li>
        </template>
        <template v-else>
          <li style="float:right" class="layui-nav-item"><a href="/login.html">登录</a></li>
          <li style="float:right" class="layui-nav-item"><a href="/reg.html">注册</a></li>
        </template>
      </ul>
      <!--轮播图-->
      <div class="layui-carousel" id="test1" lay-filter="test1" style="margin-top:0px;height: 500px" >
        <div carousel-item id="img_container" >
        </div>
      </div>
      <style>
        .el-carousel__item h3 {
          color: #475669;
          font-size: 18px;
          opacity: 0.75;
          line-height: 560px;
          margin: 0;
        }

        .el-carousel__item:nth-child(2n) {
          background-color: #99a9bf;
        }

        .el-carousel__item:nth-child(2n+1) {
          background-color: #d3dce6;
        }

      </style>

      <!--主要内容-->
      <div class="sk-event4-1-box sk-compet4-1-list-box clearfix">
        <!--左侧 竞赛列表-->
        <div class="fl sidebar-a ">
          <!-- 筛选条件 -->
          <div class="active-column-box">
            <div class="list clearfix">
              <div class="tit fl">竞赛级别：</div>
              <a href="javascript:;" @click.prevent="reset('level')" :class="competitionParam['level'] === '' ? 'item item-link active' : 'item item-link'"
                action-data="0">全部</a>
              <div class="clearfix fl" v-for="t in levelList" :key="t.name">
                <a href="javascript:;"
                  :class="competitionParam['level'] === t.bianma ? 'item item-link active' : 'item item-link'"
                  @click.prevent="getCompetitionList('',t.bianma, 'type')">{{t.name}}</a>
              </div>
            </div>




            <div class="list clearfix">
              <div class="tit fl">竞赛一级分类：</div>
              <a href="javascript:;" @click.prevent="reset('category')" :class="competitionParam['first_category'] === '' &&  competitionParam['second_category'] === '' ? 'fl item item-link active' : 'fl item item-link'"
                action-data="0">全部</a>

              <div class="fl  clearfix">


                <div class="fl item-box engineering" v-for="c in categoryList" :key="c.name">
                  <h3>
                    <a href="javascript:;"
                      :class="competitionParam['first_category'] === c.bianma ? 'item item-link active' : 'item item-link'"
                      @click.prevent="getCompetitionList(c.dictionaries_ID,c.bianma, 'category1')"><b>{{c.name}}</b></a>
                  </h3>
                </div>
              </div>
            </div>
            <div class="list clearfix" v-if="subCategoryList.length>0" style="margin-bottom: 10px;">
              <div class="tit fl">竞赛二级分类：</div>
              <div  class="fl item-box engineering" v-for="s in subCategoryList" :key="s.name">
                <a href="javascript:;"
                   :class="competitionParam['second_category'] === s.bianma ? 'item item-link active' : 'item item-link'"
                   @click.prevent="getCompetitionList(s.dictionaries_ID,s.bianma, 'category2')">{{s.name}}</a>
              </div>
            </div>
            <div class="layui-form" lay-filter="filter">
              <div class="layui-input-inline" style="width: 300px;margin-left: 20px;">
                <input type="text" v-model="keyword" placeholder="请输入关键字" autocomplete="off" class="layui-input">
              </div>
              <button class="layui-btn" @click="search"><i class="layui-icon layui-icon-search"></i>搜索</button>
              <div class="layui-input-inline">
                按热度排序
                <input type="checkbox" name="hot" lay-filter="hot" lay-skin="switch">
              </div>
            </div>
          </div>

          <!-- 竞赛列表 -->
          <div class="active-list-box" id="activeLoadContentBox">
            <ul class="list" v-for="cp in competitionList" :key="cp.COMPETITION_ID">
              <li class="item clearfix">
                <div>
                  <a :href="'competition_detail.html?id=' + cp.COMPETITION_ID" class="active-img-box fl"
                    :title="cp.COMPETITION_TITLE" target="_blank">
                    <img :src="NGINX_SERVER + cp.IMG_URL" style="object-fit: cover;">
                  </a>
                  <div class="acitve-detail-box new2016 fr">
                    <h3 class="tit">
                      <a :href="'competition_detail.html?id=' + cp.COMPETITION_ID" :title="cp.COMPETITION_TITLE"
                        class="link" target="_blank">
                        {{cp.COMPETITION_TITLE}} </a>
                    </h3>
                    <p class="active-site active-plan"><i
                        class="common-icon-big active-site-icon"></i>主办方：{{cp.ORGANISER_NAME}}
                    </p>
                    <p class="active-site active-plan"><i
                        class="common-icon-big active-site-icon"></i>竞赛级别：{{levelDict[cp.COMPETITION_LEVEL]}}
                    </p>
                    <p class="active-time active-plan"><i
                        class="common-icon-big active-time-icon"></i>报名时间：{{cp.SIGN_START_TIME}} ～
                      {{cp.SIGN_END_TIME}}</p>

                    <p class="active-time active-plan"><i
                        class="common-icon-big active-time-icon"></i>比赛时间：{{cp.COMP_START_TIME}} ～ {{cp.COMP_END_TIME}}
                    </p>

                    <p class="active-time active-plan">
                      <i
                              class="layui-icon layui-icon-read" style="line-height: 13px;font-size: 10px;"></i>浏览量：{{cp.VIEWS}}
                    </p>

                    <p class="active-time active-plan">
                      {{getInfo(cp.SIGN_END_TIME)}}

                    </p>


                    <div class="active-btn-box fr">

                      <a :href="'competition_detail.html?id=' + cp.COMPETITION_ID" class="sk-btn"
                        style="font-size:12px;" target="_blank">查看详情</a>
                    </div>
                  </div>

                </div>
              </li>
            </ul>
          </div>


          <!--分页-->
          <el-pagination :current-page="pageNum" :total="total" :page-size="pageSize" :page-sizes="[10, 5, 20]"
            style="padding: 30px 0; text-align: center" layout="sizes, prev, pager, next, jumper, ->, total"
            @current-change="changeCurrentPage" @size-change="changePageSize" />
        </div>
        <!-- 浏览记录 -->
        <div class="sidebar-b fr">
          <div class="sidebar-b-con">
            <div class="title-box">
              <h3 class="title">最近竞赛</h3>
            </div>
            <div class="new-active-box" v-for="cmp in recentList">
              <div class="new-active-list">
                <a :href="'competition_detail.html?id=' + cmp.COMPETITION_ID" :title="cmp.COMPETITION_TITLE"
                   class="new-active-item clearfix" target="_blank">
                  <div class="active-img-box fl">
                    <img :src="NGINX_SERVER + cmp.IMG_URL" :alt="cmp.COMPETITION_TITLE" />
                  </div>
                  <div class="acitve-detail-box fr">
                    <h3 class="tit">
                      <div class="link">{{cmp.COMPETITION_TITLE}}</div>
                    </h3>
                    <div style="color: #ccc;font-size:8px">竞赛级别：{{levelDict[cmp.COMPETITION_LEVEL]}}</div>
                    <div class="active-data-box clearfix">
                      <span class="fl">{{cmp.COMP_START_TIME}}</span>
                      <span class="active-data-con fr"><i
                              class="common-icon-big active-scan-icon"></i>{{cmp.VIEWS}}</span>
                    </div>
                  </div>

                </a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="footer-wrap v-4-2">
      <div class="footer other">
        <div class="common-box footer-box">
          <div class="to-top-box" id="toUpBox">
            <!--<a href="javascript:;" target="_blank" class="common-icon-big to-feedback-btn" title="意见反馈"></a>-->
            </a>
            <div class="iradio-2 to-msite-btn to-msite-btn-2" title="微信公众号">
            <span class="weixin-box" style="margin-top: -42px;">
              <img src="/static/images/erweima.jpg" alt="微信公众号">
              <span class="weixin-txt">关注赛er订阅号</span>
              <img src="/static/images/kefu.jpg" alt="微信客服">
              <span class="weixin-txt">添加赛er客服</span>
              <span class="arrow arrow-right boxL-cor" style="margin-top: -70px;"></span>
            </span>
            </div>
            <a href="javascript:;" class="to-top-btn common-icon-big" id="toUp" title="返回顶部"></a>
          </div>
          <div class="fl ft-info-box">
            <div class="ft-tit" title="关于赛er">关于赛er</div>
            <ul class="ft-list">
              <li class="item">
                <a href="" title="了解赛er" target="_blank" rel="nofollow">了解赛er</a>
              </li>
              <li class="item">
                <a href="./contact.html" title="服务协议" target="_blank" rel="nofollow">服务协议</a>
              </li>
              <li class="item">
                <a href="" title="合作伙伴" target="_blank" rel="nofollow">合作伙伴</a>
              </li>
              <li class="item">
                <a href="" title="加入我们" target="_blank" rel="nofollow">加入我们</a>
              </li>
              <li class="item">
                <a href="" title="隐私协议" target="_blank" rel="nofollow">隐私协议</a>
              </li>
            </ul>
          </div>
          <div class="fl ft-info-box">
            <div class="ft-tit" title="帮助中心">帮助中心</div>
            <ul class="ft-list">
              <li class="item">
                <a href="" title="常见问题" target="_blank" rel="nofollow">常见问题</a>
              </li>
              <li class="item">
                <a href="./legal.html" title="社区规范" target="_blank" rel="nofollow">社区规范</a>
              </li>
              <li class="item">
                <a href="" title="意见反馈" target="_blank" rel="nofollow">意见反馈</a>
              </li>
            </ul>
          </div>
          <div class="fr ft-info-box" style="width: 200px;">
            <div class="ft-tit" title="在线客服">联系我们</div>
            <ul class="ft-list">
              <li class="item">
                赛er<span class="item-dot"></span>客服QQ：<a href="https://wpa.qq.com/msgrd?v=3&uin=412414867&site=qq&menu=yes">412414867</a>
              </li>
              <li class="item">
                赛er<span class="item-dot"></span>官方QQ群：320513949
              </li>
            </ul>
          </div>

        </div>
      </div>
      <!-- 备案 footer -->
      <div class="ft-btm">
        <div class="common-box ft-btm-box">
          <div class="btn-con">
            <span class="ft-paragraph">©<span id="nowYear"></span>赛er<span class="s-4"></span></span>
            <span><a href="https://beian.miit.gov.cn/" target="_blank" style="color: #555;">苏ICP备2021019825号</a></span>
          </div>
        </div>
      </div>
    </div>
  </div>


<script>
  toTopFun();
</script>
</body>
<script src="/static/js/layer.js"></script>
<script src="/static/js/wx_bind.js"></script>

<!--vue-->
<script>
  var bannerCarousel="";
  var form;
  layui.use("form",function () {
    form = layui.form;
    form.on('switch(hot)',function (data) {
      app.hot = this.checked ? 'true' : 'false';
      if(app.hot=='true'){
        app.keyword="";
        app.competitionParam['level'] = "";
        app.competitionParam['first_category'] = "";
        app.competitionParam['second_category'] = "";
      }
      app.competitionParam["pageNum"] = 1
      app.competitionParam["hot"] = app.hot
      getDataByPost("api/competition/list", app.competitionParam, function (res) {
        app.competitionList = res.data.list;
        app.total = res.data.total;
      })
    })
  })
  const app = new Vue({
    el: "#app",
    data: {
      user: '',
      bannerList: [],//轮播图列表
      swiperOption: {
        // 配置分页
        pagination: {
          el: '.swiper-pagination'// 分页的dom节点
        },
        // 配置导航
        navigation: {
          nextEl: '.swiper-button-next', // 下一页dom节点
          prevEl: '.swiper-button-prev'// 前一页dom节点
        }
      },
      hot:"false",
      NGINX_SERVER: NGINX_SERVER,
      categoryList: [],
      subCategoryList: [],
      levelList: [{ name: '不限', bianma: '' }, { name: '线上', bianma: 'online' }, { name: '线下', bianma: 'offline' }],
      levelDict: {},
      competitionParam: { "first_category": "", "second_category": "", "category": "", "level": "", "pageNum": "", "pageSize": "","keyword":"" ,"hot":"false"},
      competitionList: [],
      keyword:"",
      pageNum: "1", //页码
      pageSize: "10", //每页记录数
      total: 20, // 总记录数
      recentList:[],
      unreadCount: 0
    },
    computed: {

    },
    methods: {
      getInfo(ds) {
        let date1 = new Date(ds)
        let date2 = new Date()
        if (date1 < date2) {
          return "报名已截止"
        } else {
          let num = date1.getTime() - date2.getTime();
          num = num / 1000 / 60 / 60 / 24
          num = parseInt(num)+2;
          return "距离报名截止还有 " + num + " 天"
        }
      },
      //获取轮播图
      getBannerList() {
        let _this = this;
        getDataByGet("api/banner/getBanner", null, function (res) {
          _this.bannerList = res.data;
        })
      },
      //获取分类列表
      getCategoryList() {
        let _this = this;
        getDataByGet("api/base/getCompetitionFirstCategory", null, function (res) {
          _this.categoryList = res.data;
          // _this.$forceUpdate()
        })
      },
      //获取级别列表
      getLevelList() {
        let _this = this;
        getDataByGet("api/base/getCompetitionAllLevel", null, function (res) {
          _this.levelList = res.data;
          for (let i = 0; i < _this.levelList.length; i++) {
            _this.levelDict[_this.levelList[i]["bianma"]] = _this.levelList[i]["name"];
          }

          _this.$forceUpdate()
        })
      },
      //获取竞赛列表
      getCompetitionList(id,pv, pt) {
        app.hot="false";
        form.val("filter",{
          "hot":false
        })
        if (pt === 'category1') {
          this.competitionParam["first_category"] = pv;
          this.competitionParam["second_category"] = "";
          getDataByGet("api/base/getSubDictionary?id="+id, null, function (res) {
            _this.subCategoryList = res.data;
            // _this.$forceUpdate()
          })
        } else if (pt === 'category2') {
          this.competitionParam["second_category"] = pv;
        } else {
          this.competitionParam["level"] = pv;
        }
        let _this = this;
        this.competitionParam["pageNum"] = this.pageNum;
        this.competitionParam["pageSize"] = this.pageSize;
        this.competitionParam["hot"] = this.hot;
        getDataByPost("api/competition/list", _this.competitionParam, function (res) {
          _this.competitionList = res.data.list;
          _this.total = res.data.total;
        })
      },
      search(){
        let _this = this;
        app.hot="false";
        form.val("filter",{
          "hot":false
        })
        this.pageNum=1;
        _this.competitionParam["keyword"] = this.keyword
        _this.competitionParam["hot"] = app.hot
        _this.competitionParam["pageNum"] = this.pageNum
        getDataByPost("api/competition/list", _this.competitionParam, function (res) {
          _this.competitionList = res.data.list;
          _this.total = res.data.total;
        })
      },
      reset(pt) {
        if (pt === 'category') {
          this.competitionParam["first_category"] = "";
          this.competitionParam["second_category"] = "";
          this.subCategoryList=[];
        } else {
          this.competitionParam["level"] = "";
        }
        let _this = this;
        this.pageNum=1;
        this.competitionParam["pageNum"] = this.pageNum;
        this.competitionParam["pageSize"] = this.pageSize;
        getDataByPost("api/competition/list", _this.competitionParam, function (res) {
          _this.competitionList = res.data.list;
          _this.total = res.data.total;
        })
      },
      //初始化竞赛列表
      initcompetitionList() {
        let _this = this;
        // this.competitionParam["second_category"] = "competition_engineering_course_1";
        // this.competitionParam["COMPETITION_TYPE"] = "competition_type_1";
        this.competitionParam["pageNum"] = this.pageNum;
        this.competitionParam["pageSize"] = this.pageSize;

        getDataByPost("api/competition/list", _this.competitionParam, function (res) {
          _this.competitionList = res.data.list;
          _this.total = res.data.total;
        })
      },
      // 改变页码
      changeCurrentPage(page) {

        this.pageNum = page
        this.initcompetitionList()
      },

      // 改变每页记录数
      changePageSize(size) {

        this.pageSize = size
        this.initcompetitionList()
      },
      setBanner(){
        var b = 2000/768;//我的图片比例
        // 获取浏览器宽度
        var W = $(window).width();
        var H = $(window).height();
        layui.use('carousel', function(){
          var carousel = layui.carousel;
          //建造实例
          if(bannerCarousel==""){
            bannerCarousel = carousel.render({ elem: '#test1' ,width: '100%'
              //设置容器宽度
              ,height: (W/b).toString()+"px"
              //按比例和浏览器可视页面宽度来获取高度
              ,arrow: 'always'
              ,indicator: 'inside'    //这个属性：小圆点在外面
            });
          }else{
            bannerCarousel.reload({ elem: '#test1' ,width: '100%'
              //设置容器宽度
              ,height: (W/b).toString()+"px"
              //按比例和浏览器可视页面宽度来获取高度
              ,arrow: 'always'
              ,indicator: 'inside'    //这个属性：小圆点在外面
            });
          }
        })

      }
    },
    //生命周期相关函数
    created() {
      getUnreadCount(data => {
        app.unreadCount = data;
      });
      this.getBannerList();
      this.getCategoryList();
      this.getLevelList();
      this.initcompetitionList();
      this.user = JSON.parse(sessionStorage.getItem("userInfo"))
      $(window).resize(function () {
        app.setBanner();
      })
      getDataByGet('api/banner/getBanner',{},function (res){
        app.bannerList = res.data;
        app.bannerList.forEach(item=>{
          $("#img_container").append("<a href='"+item.URL+"' target='_blank'><img style='width: 100%' src='"+NGINX_SERVER+item.IMG_URL+"'/></a>")
        })
        app.setBanner();
      })


      getDataByPost("api/competition/list", {
        pageNum:1,
        pageSize:5,
        hot:"false"
      }, function (res) {
        app.recentList = res.data.list;
      })

    }
  })

  //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
  layui.use('element', function () {
    var element = layui.element;

    //…
  });
</script>

</html>
